package com.mdd.front.validate;

import com.mdd.common.validator.annotation.IDMust;
import com.mdd.common.validator.annotation.IntegerContains;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * 订单参数
 * @author panweiliang
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class OrderParam extends BaseParam {

    @IDMust(message = "id参数必传且需大于0", groups = {update.class, delete.class, change.class})
    private Integer id;

//    @NotNull(message = "userId参数缺失", groups = {create.class, update.class})
//    @DecimalMin(value = "0", message = "userId参数值不能少于0", groups = {create.class, update.class})
    private Integer userId;

    @NotNull(message = "courseId参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "courseId参数值不能少于0", groups = {create.class, update.class})
    private Integer courseId;

    @NotNull(message = "orderTerminal参数缺失", groups = {create.class, update.class})
    @IntegerContains(values = {1, 2, 3, 4, 5, 6}, message = "orderTerminal参数值不在符合范围", groups = {create.class, update.class})
//    订单来源;1-微信小程序;2-微信公众号;3-手机H5;4-PC;5-苹果app;6-安卓app;
    private Integer orderTerminal = 1;

//    @NotNull(message = "payWay参数缺失", groups = {create.class, update.class})
    @IntegerContains(values = {-1, 1, 2, 3}, message = "payWay参数值不在符合范围", groups = {create.class, update.class})
//    支付方式:1-余额支付;2-微信支付;3-支付宝支付;
    private Integer payWay = -1;

//    @NotNull(message = "totalAmount参数缺失", groups = {create.class, update.class})
    private BigDecimal totalAmount;

//    @NotNull(message = "orderAmount参数缺失", groups = {create.class, update.class})
    private BigDecimal orderAmount;

    private BigDecimal couponDiscountPrice;  // 优惠券优惠的价格

    private BigDecimal integralDiscountPrice;  // 积分优惠的价格

}
